package jackson.src.day02;

/*
 * Author: JacksonCoder
 * FileName: extendsDemo
 * Version: 1.0.0
 */
public class extendsDemo {
    public static void main(String[] args) {
        System.out.println("this is start!!!");

        Person1 p = new Person1("小明", 13);
        Student s = new Student("小红", 20,88);
        PrimaryStudent s1 = new PrimaryStudent("小刚", 22, 99,5);
        System.out.println(s1.getScore());
        System.out.println(s1.getClass());
        System.out.println(s1.grade);

    }
}

class Person1 {
    protected String name;
    protected int age;

    public Person1(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}

class Student extends Person1 {
    protected int score;

    public Student(String name, int age, int score) {
        super(name, age);
        this.score = score;
    }

    public int getScore() {return score;}
}

class PrimaryStudent extends Student{
    protected int grade;

    public PrimaryStudent(String name, int age, int score,int grade){
        super(name,age,score);
        this.grade = grade;
    }

}